package 剑指offer;

import leetcode.ListNode;

import java.util.List;

public class Offer52_JZ36 {
    public ListNode FindFirstCommonNode(ListNode pHead1, ListNode pHead2) {
        ListNode a = pHead1;
        ListNode b = pHead2;
        while (a != b) {
            a = a != null ? a.next : pHead2;
            b = b!= null ? b.next : pHead1;
        }
        return a;
    }
}
